package com.dingwen.treasure.websocket.server.controller;

import com.dingwen.treasure.websocket.server.handler.TreasureWebsocketHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 　PushController： 消息推送
 * 　@author dingwen
 * 　@date 2022/8/31
 */
@RestController
@RequestMapping("push")
public class PushController {

    @Resource(name = "treasureWebsocketHandler")
    private TreasureWebsocketHandler treasureWebsocketHandler;

    @GetMapping()
    public void test(@RequestParam("channel") String channel, @RequestParam("message") String message) {
        treasureWebsocketHandler.sendMessage(channel, message);
    }
}
